#第1步 初识编译正则表达式
import re

regex=re.compile(r'\S+ +\d+ +\S+ +\S+ + \S+ +\w+ +\S+')
print(regex)
print(type(regex))
print(help(re.Pattern))

#第2步，查看Pattern对象常用方法
print([method for method in dir(regex) if not method.startswith('_')])

print([method for method in dir(re.Pattern) if not method.startswith('_')])

line = '4c1f-ccd0-2d35 1           -      -      Eth0/0/5        dynamic   0/-      '
match=regex.search(line)
print(match.group())

line2 = '4c1f-ccb5-2a33 105           -      -      Eth0/0/2        dynamic   0/-   '
match2=regex.search(line2)
print(match2.group())